<script setup>
import { useLogin } from "../stores/login.js";
import router from "@/router/index.js";
import { ref, onMounted } from "vue";
const loginstore = useLogin();
const username = ref("");
const password = ref("");
onMounted(() => {});
let submit = () => {
    let obj = {
        adminname: username.value,
        password: password.value,
    };
    loginstore.loginreq(obj);
    //console.log("loginstore.data", loginstore.data);
    if (loginstore.data.data.code == 200) {
        //console.log("登录成功");
        router.push("/list");
    }
};
</script>

<template>
    <div class="login-wrapper">
        <div class="header">Login</div>
        <div class="form-wrapper">
            <input type="text" v-model="username" name="username" placeholder="username" class="input-item" />
            <input type="password" v-model="password" name="password" placeholder="password" class="input-item" />
            <div @click="submit" class="btn">Login</div>
        </div>
        <div class="msg">
            Don't have account?
            <router-link to="/register">Sign Up </router-link>
        </div>
    </div>
</template>
<style scoped>
.login-wrapper {
    background-color: #fff;
    width: 358px;
    height: 588px;
    border-radius: 15px;
    margin: 50px auto;
    /* box-shadow: 2px 2px 2px 2px rgba(0, 0, 0, 0.1); */
    box-shadow: rgba(0, 0, 0, 0.5) 0px 0px 14px 0px;
}
.header {
    font-size: 38px;
    font-weight: bold;
    text-align: center;
    line-height: 200px;
}
.input-item {
    display: block;
    width: 80%;
    margin: 0 auto;
    margin-bottom: 20px;
    border: 0;
    padding: 10px;
    border-bottom: 1px solid rgb(128, 125, 125);
    font-size: 15px;
    outline: none;
}
.input-item:placeholder {
    text-transform: uppercase;
}
.btn {
    display: block;
    width: 80%;
    text-align: center;
    padding: 10px;
    margin: 0 auto;

    margin-top: 40px;
    background-image: linear-gradient(to right, #9bbdf7, #6370ff);
    color: #fff;
}
.msg {
    text-align: center;
    line-height: 88px;
}
/* a {
    text-decoration-line: none;
    color: #abc1ee;
} */
</style>
